<template>
    <v-dialog
      v-model="showMe"
      max-width="500"
    >
      <v-card>
        <v-card-title class="headline">{{title}}</v-card-title>

        <v-card-text>
          {{msg}}
        </v-card-text>

        <v-card-actions>
          <v-spacer></v-spacer>

          <v-btn
            color="red darken-1"
            flat="flat"
            @click="closeMe(false)"
          >
            取消
          </v-btn>

          <v-btn
            color="green darken-1"
            flat="flat"
            @click="closeMe(true)"
          >
            确定
          </v-btn>
        </v-card-actions>
      </v-card>
    </v-dialog>
  
</template>

<script>
export default {
    props:{
        title:{
            type: String,
            required: true
        },
        msg:{
            type: String,
            required: true
        },
        show:{
            type: Boolean,
            required: true
        }        
    },
    watch:{
        show(v){
            this.showMe = v
        }
    },
    data(){
        return {
            showMe: false
        }
    },
    methods: {
        closeMe(ok){
            eventBus.$emit("confirm-dialog-closed",ok)
        }
    }
}
</script>
